import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

public class Pand {
    public static JFrame window  = new JFrame();
    MouseClickExample mouseClickExample;

    public static void main(String[] args) {
        Thread.setDefaultUncaughtExceptionHandler(new Erro());
        Pand pand = new Pand();
    }
    public Pand(){
        Font f = new Font("隶书",Font.PLAIN,20);
        JButton button = new JButton("选择截");
        JButton button2 = new JButton("截全屏");
        button.setFont(f);
        button2.setFont(f);
        button.setContentAreaFilled(false);
        button2.setContentAreaFilled(false);
        button.setBorder(null);//去按钮边框
        button2.setBorder(null);
        window.setLayout(null);
        window.setBounds(500,0,400,100);
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.setResizable(false);
        window.setVisible(true);
        window.setTitle("Pingwzh");
        window.add(button);
        window.add(button2);

        button.setBounds(0,0,100,50);
        button2.setBounds(100,0,100,50);

button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        window.setVisible(false);
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new MouseClickExample();
            }
        });

    }
});
button2.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        window.setVisible(false);
        try {
            Thread.sleep(500);

        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
        Dimension scrSize=Toolkit.getDefaultToolkit().getScreenSize();
        mouseClickExample = new MouseClickExample();

        mouseClickExample.img(0,0,scrSize.width,scrSize.height);
        window.setVisible(true);
        new Wenjian().wen();
    }
});
    }

}
